Component({
  data: {
    selected: 0,
    list: [{
        pagePath: "/pages/main/index",
        iconPath: "../images/icon_index.png",
        selectedIconPath: "../images/icon_index.png",
        text: "首页"
      },
      {
        pagePath: "/pages/cate/index",
        iconPath: "../images/icon_cate.png",
        selectedIconPath: "../images/icon_cate.png",
        text: "好物"
      },
      {
        pagePath: "/pages/cart/index",
        iconPath: "../images/icon_cart.png",
        selectedIconPath: "../images/icon_cart.png",
        text: "购物车"
      },
      {
        pagePath: "/pages/person/index",
        iconPath: "../images/icon_my.png",
        selectedIconPath: "../images/icon_my.png",
        text: "我的"
      }
    ]
  },
  methods: {
    switchTabHandle: function (e) {
      const dataset = e.currentTarget.dataset;
      const {
        url,
        sort
      } = dataset;
      this.setData({
        selected: sort
      })
      wx.switchTab({url})
    }
  }
})